Contour from a list of {lat,long,values}












0















I need to create a contour using python. The problem is that all the solutions I have found so far are mesh based which require 3 arrays:
lats array
long array
values array
then they use mesh to make the contour.
The problem in my case is that every single value has a different lat and long and it's more like the following array
[{lat,long,values},{lat,long,values},{lat,long,values},{lat,long,values}]



I appreciate any solution or recommendation



the original values are like this. 3 2D arrays



Values :



[[[2.3000e-01 2.2250e-01 2.3500e-01 ... 5.0000e-03 1.2500e-02 1.2500e-02]
[2.3250e-01 2.2500e-01 2.3000e-01 ... 7.5000e-03 1.2500e-02 1.2500e-02]
[2.4500e-01 2.3000e-01 2.2250e-01 ... 7.5000e-03 1.2500e-02 1.2500e-02]
...
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]]]


Lats:



[[18.14503    18.17840149 18.21173404 ... 20.95232678 20.92303157
20.89368282]
[18.19869826 18.23212537 18.26551351 ... 21.01085369 20.98150583
20.95210438]
[18.25238237 18.28586518 18.31930902 ... 21.06940562 21.04000501
21.01055075]
...
[47.37108253 47.45317877 47.53531405 ... 54.84178113 54.75671371
54.67167336]
[47.35484472 47.43689746 47.51898908 ... 54.82084335 54.73583959
54.65086259]
[47.33843536 47.42044418 47.5024917 ... 54.79968906 54.71474955
54.62983649]]


longs:



[[217.107456   217.16395904 217.22053137 ... 275.5738218  275.63644491
275.69899943]
[217.07228304 217.12882027 217.18542696 ... 275.60519679 275.66787119
275.73047681]
[217.03704065 217.09361204 217.15025307 ... 275.63664054 275.69936627
275.762023 ]
...
[147.8669735 147.84307356 147.81907208 ... 352.75647981 352.72040049
352.68450633]
[147.74583254 147.72168602 147.697437 ... 352.90413813 352.86770214
352.8314529 ]
[147.62479343 147.60040096 147.57590506 ... 353.05160828 353.01481704
352.97821413]]


I extracted this values from a netcdf file










share|improve this question

























  • Please add some example input and expected output.

    – Benjámin Budai
    Nov 26 '18 at 16:49











  • I would look into interpolating your points onto a regular 2D grid, for example using scipy.interpolate.griddata

    – xnx
    Nov 26 '18 at 18:21











  • @xnx Thanks for your response. I thought about interpolation. but I don't want to scrifice the accuracy of values as far as it is possible. Do you know any other solution?

    – sun1987
    Nov 26 '18 at 19:01






  • 1





    @sun1987 a contour joins latitude and longitude points with the same value. So unless your data contains the coordinates of points with contour values points you want to indicate, I don't see how you can do what you want without interpolation of some kind.

    – xnx
    Nov 27 '18 at 7:43











  • Thans right. thank you @xnx

    – sun1987
    Nov 27 '18 at 16:02
















0















I need to create a contour using python. The problem is that all the solutions I have found so far are mesh based which require 3 arrays:
lats array
long array
values array
then they use mesh to make the contour.
The problem in my case is that every single value has a different lat and long and it's more like the following array
[{lat,long,values},{lat,long,values},{lat,long,values},{lat,long,values}]



I appreciate any solution or recommendation



the original values are like this. 3 2D arrays



Values :



[[[2.3000e-01 2.2250e-01 2.3500e-01 ... 5.0000e-03 1.2500e-02 1.2500e-02]
[2.3250e-01 2.2500e-01 2.3000e-01 ... 7.5000e-03 1.2500e-02 1.2500e-02]
[2.4500e-01 2.3000e-01 2.2250e-01 ... 7.5000e-03 1.2500e-02 1.2500e-02]
...
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]]]


Lats:



[[18.14503    18.17840149 18.21173404 ... 20.95232678 20.92303157
20.89368282]
[18.19869826 18.23212537 18.26551351 ... 21.01085369 20.98150583
20.95210438]
[18.25238237 18.28586518 18.31930902 ... 21.06940562 21.04000501
21.01055075]
...
[47.37108253 47.45317877 47.53531405 ... 54.84178113 54.75671371
54.67167336]
[47.35484472 47.43689746 47.51898908 ... 54.82084335 54.73583959
54.65086259]
[47.33843536 47.42044418 47.5024917 ... 54.79968906 54.71474955
54.62983649]]


longs:



[[217.107456   217.16395904 217.22053137 ... 275.5738218  275.63644491
275.69899943]
[217.07228304 217.12882027 217.18542696 ... 275.60519679 275.66787119
275.73047681]
[217.03704065 217.09361204 217.15025307 ... 275.63664054 275.69936627
275.762023 ]
...
[147.8669735 147.84307356 147.81907208 ... 352.75647981 352.72040049
352.68450633]
[147.74583254 147.72168602 147.697437 ... 352.90413813 352.86770214
352.8314529 ]
[147.62479343 147.60040096 147.57590506 ... 353.05160828 353.01481704
352.97821413]]


I extracted this values from a netcdf file










share|improve this question

























  • Please add some example input and expected output.

    – Benjámin Budai
    Nov 26 '18 at 16:49











  • I would look into interpolating your points onto a regular 2D grid, for example using scipy.interpolate.griddata

    – xnx
    Nov 26 '18 at 18:21











  • @xnx Thanks for your response. I thought about interpolation. but I don't want to scrifice the accuracy of values as far as it is possible. Do you know any other solution?

    – sun1987
    Nov 26 '18 at 19:01






  • 1





    @sun1987 a contour joins latitude and longitude points with the same value. So unless your data contains the coordinates of points with contour values points you want to indicate, I don't see how you can do what you want without interpolation of some kind.

    – xnx
    Nov 27 '18 at 7:43











  • Thans right. thank you @xnx

    – sun1987
    Nov 27 '18 at 16:02














0












0








0








I need to create a contour using python. The problem is that all the solutions I have found so far are mesh based which require 3 arrays:
lats array
long array
values array
then they use mesh to make the contour.
The problem in my case is that every single value has a different lat and long and it's more like the following array
[{lat,long,values},{lat,long,values},{lat,long,values},{lat,long,values}]



I appreciate any solution or recommendation



the original values are like this. 3 2D arrays



Values :



[[[2.3000e-01 2.2250e-01 2.3500e-01 ... 5.0000e-03 1.2500e-02 1.2500e-02]
[2.3250e-01 2.2500e-01 2.3000e-01 ... 7.5000e-03 1.2500e-02 1.2500e-02]
[2.4500e-01 2.3000e-01 2.2250e-01 ... 7.5000e-03 1.2500e-02 1.2500e-02]
...
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]]]


Lats:



[[18.14503    18.17840149 18.21173404 ... 20.95232678 20.92303157
20.89368282]
[18.19869826 18.23212537 18.26551351 ... 21.01085369 20.98150583
20.95210438]
[18.25238237 18.28586518 18.31930902 ... 21.06940562 21.04000501
21.01055075]
...
[47.37108253 47.45317877 47.53531405 ... 54.84178113 54.75671371
54.67167336]
[47.35484472 47.43689746 47.51898908 ... 54.82084335 54.73583959
54.65086259]
[47.33843536 47.42044418 47.5024917 ... 54.79968906 54.71474955
54.62983649]]


longs:



[[217.107456   217.16395904 217.22053137 ... 275.5738218  275.63644491
275.69899943]
[217.07228304 217.12882027 217.18542696 ... 275.60519679 275.66787119
275.73047681]
[217.03704065 217.09361204 217.15025307 ... 275.63664054 275.69936627
275.762023 ]
...
[147.8669735 147.84307356 147.81907208 ... 352.75647981 352.72040049
352.68450633]
[147.74583254 147.72168602 147.697437 ... 352.90413813 352.86770214
352.8314529 ]
[147.62479343 147.60040096 147.57590506 ... 353.05160828 353.01481704
352.97821413]]


I extracted this values from a netcdf file










share|improve this question
















I need to create a contour using python. The problem is that all the solutions I have found so far are mesh based which require 3 arrays:
lats array
long array
values array
then they use mesh to make the contour.
The problem in my case is that every single value has a different lat and long and it's more like the following array
[{lat,long,values},{lat,long,values},{lat,long,values},{lat,long,values}]



I appreciate any solution or recommendation



the original values are like this. 3 2D arrays



Values :



[[[2.3000e-01 2.2250e-01 2.3500e-01 ... 5.0000e-03 1.2500e-02 1.2500e-02]
[2.3250e-01 2.2500e-01 2.3000e-01 ... 7.5000e-03 1.2500e-02 1.2500e-02]
[2.4500e-01 2.3000e-01 2.2250e-01 ... 7.5000e-03 1.2500e-02 1.2500e-02]
...
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]
[1.1979e+02 1.1979e+02 1.1979e+02 ... 6.9500e-01 7.0000e-01 7.0500e-01]]]


Lats:



[[18.14503    18.17840149 18.21173404 ... 20.95232678 20.92303157
20.89368282]
[18.19869826 18.23212537 18.26551351 ... 21.01085369 20.98150583
20.95210438]
[18.25238237 18.28586518 18.31930902 ... 21.06940562 21.04000501
21.01055075]
...
[47.37108253 47.45317877 47.53531405 ... 54.84178113 54.75671371
54.67167336]
[47.35484472 47.43689746 47.51898908 ... 54.82084335 54.73583959
54.65086259]
[47.33843536 47.42044418 47.5024917 ... 54.79968906 54.71474955
54.62983649]]


longs:



[[217.107456   217.16395904 217.22053137 ... 275.5738218  275.63644491
275.69899943]
[217.07228304 217.12882027 217.18542696 ... 275.60519679 275.66787119
275.73047681]
[217.03704065 217.09361204 217.15025307 ... 275.63664054 275.69936627
275.762023 ]
...
[147.8669735 147.84307356 147.81907208 ... 352.75647981 352.72040049
352.68450633]
[147.74583254 147.72168602 147.697437 ... 352.90413813 352.86770214
352.8314529 ]
[147.62479343 147.60040096 147.57590506 ... 353.05160828 353.01481704
352.97821413]]


I extracted this values from a netcdf file







python mesh contour netcdf4






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 18:16







sun1987

















asked Nov 26 '18 at 16:16









sun1987sun1987

59111




59111













  • Please add some example input and expected output.

    – Benjámin Budai
    Nov 26 '18 at 16:49











  • I would look into interpolating your points onto a regular 2D grid, for example using scipy.interpolate.griddata

    – xnx
    Nov 26 '18 at 18:21











  • @xnx Thanks for your response. I thought about interpolation. but I don't want to scrifice the accuracy of values as far as it is possible. Do you know any other solution?

    – sun1987
    Nov 26 '18 at 19:01






  • 1





    @sun1987 a contour joins latitude and longitude points with the same value. So unless your data contains the coordinates of points with contour values points you want to indicate, I don't see how you can do what you want without interpolation of some kind.

    – xnx
    Nov 27 '18 at 7:43











  • Thans right. thank you @xnx

    – sun1987
    Nov 27 '18 at 16:02



















  • Please add some example input and expected output.

    – Benjámin Budai
    Nov 26 '18 at 16:49











  • I would look into interpolating your points onto a regular 2D grid, for example using scipy.interpolate.griddata

    – xnx
    Nov 26 '18 at 18:21











  • @xnx Thanks for your response. I thought about interpolation. but I don't want to scrifice the accuracy of values as far as it is possible. Do you know any other solution?

    – sun1987
    Nov 26 '18 at 19:01






  • 1





    @sun1987 a contour joins latitude and longitude points with the same value. So unless your data contains the coordinates of points with contour values points you want to indicate, I don't see how you can do what you want without interpolation of some kind.

    – xnx
    Nov 27 '18 at 7:43











  • Thans right. thank you @xnx

    – sun1987
    Nov 27 '18 at 16:02

















Please add some example input and expected output.

– Benjámin Budai
Nov 26 '18 at 16:49





Please add some example input and expected output.

– Benjámin Budai
Nov 26 '18 at 16:49













I would look into interpolating your points onto a regular 2D grid, for example using scipy.interpolate.griddata

– xnx
Nov 26 '18 at 18:21





I would look into interpolating your points onto a regular 2D grid, for example using scipy.interpolate.griddata

– xnx
Nov 26 '18 at 18:21













@xnx Thanks for your response. I thought about interpolation. but I don't want to scrifice the accuracy of values as far as it is possible. Do you know any other solution?

– sun1987
Nov 26 '18 at 19:01





@xnx Thanks for your response. I thought about interpolation. but I don't want to scrifice the accuracy of values as far as it is possible. Do you know any other solution?

– sun1987
Nov 26 '18 at 19:01




1




1





@sun1987 a contour joins latitude and longitude points with the same value. So unless your data contains the coordinates of points with contour values points you want to indicate, I don't see how you can do what you want without interpolation of some kind.

– xnx
Nov 27 '18 at 7:43





@sun1987 a contour joins latitude and longitude points with the same value. So unless your data contains the coordinates of points with contour values points you want to indicate, I don't see how you can do what you want without interpolation of some kind.

– xnx
Nov 27 '18 at 7:43













Thans right. thank you @xnx

– sun1987
Nov 27 '18 at 16:02





Thans right. thank you @xnx

– sun1987
Nov 27 '18 at 16:02












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53485143%2fcontour-from-a-list-of-lat-long-values%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53485143%2fcontour-from-a-list-of-lat-long-values%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)